<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="img/favicon.png">

    <title>南牧物联网云平台</title>

    <!-- Bootstrap core CSS -->
    <link href="__PUBLIC__/css/bootstrap.css" rel="stylesheet">
    <link href="__PUBLIC__/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="__PUBLIC__/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
	<link href="__PUBLIC__/assets/morris.js-0.4.3/morris.css" rel="stylesheet" />
    <link href="__PUBLIC__/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="stylesheet" href="__PUBLIC__/css/owl.carousel.css" type="text/css">

      <!--right slidebar-->
      <link href="__PUBLIC__/css/slidebars.css" rel="stylesheet">

    <!-- Custom styles for this template -->

    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style-responsive.css" rel="stylesheet" />

  </head>

  <body>
		<div class="mybar">
			 <div class="main_nav_bottom">
                <nav class="navbar navbar-inverse navbar-fixed-top">
                    <div class="container" align="center">
                        <ul class="nav nav-tabs nav-tabs-justified">
                           
                                <button onclick="readBW800clock();" type="button" class="btn btn-primary">读取时间</button>
								<button onclick="writeBW800clock();" type="button" class="btn btn-success">设置时间</button>
								<button onclick="readBW800para();" type="button" class="btn btn-primary">读取参数</button>
								<button onclick="writeBW800para();" type="button" class="btn btn-success">设置参数</button>
											  
								<button onclick="savebw800();" type="button" class="btn btn-success">保存</button>
                            
                        </ul>
                    </div>
                </nav>
            </div>
			  
		    <div class="row">
			  <div class="col-lg-12">
				  <!--breadcrumbs start -->
				  <ul class="breadcrumb">
					  <li><a href="#" onclick="parent.document.getElementById('id-a-Index').click();parent.document.getElementById('id-a-Index-home').click();"><i class="fa fa-dashboard"></i> 养殖场</a></li>
					  <li><a href="#" onclick="parent.document.getElementById('id-a-Setting-home').click();"></i>设备管理</a></li>
					  <li class="active">饲喂器管理</li>
				  </ul>
				  <!--breadcrumbs end -->
			  </div>
		    </div>
			<div class="row">
				<div class="col-lg-12">
					<form  id="id-form-system">
						<section class="panel">
							<header class="panel-heading">
								产前设置
							</header>
							<div class="panel-body">
								<div class="form-group">
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">天数</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='cqsettingday' placeholder="" value="{$bw800Model['cqsettingday']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">猪编号</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='cqsettingcode' placeholder="" value="{$bw800Model['cqsettingcode']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>

									</div>
									
									<div class="row">
										<div class="form-group">
											<div class="col-lg-8">
												<button onclick="cqsetting();" type="button" class="btn btn-success">下发设置</button>
											</div>
										</div>
									</div>
									
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								哺乳设置
							</header>
							<div class="panel-body">
								<div class="form-group">
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">天数</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='brsettingday' placeholder="" value="{$bw800Model['brsettingday']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">猪编号</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='brsettingcode' placeholder="" value="{$bw800Model['brsettingcode']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>

										<label for="input2" class="col-lg-1 col-sm-2 control-label">猪仔数</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='brsettingbabycount' placeholder="" value="{$bw800Model['brsettingbabycount']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									</div>
									
									<div class="row">
										<div class="form-group">
											<div class="col-lg-8">
												<button onclick="brsetting();" type="button" class="btn btn-success">下发设置</button>
											</div>
										</div>
									</div>
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								断奶设置
							</header>
							<div class="panel-body">
								<div class="form-group">
									<div class="row">
										<div class="form-group">
											<div class="col-lg-8">
												<button onclick="dnsetting();" type="button" class="btn btn-success">下发设置</button>
											</div>
										</div>
									</div>
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								下料
							</header>
							<div class="panel-body">
								<div class="form-group">
									<div class="row">
										<div class="form-group">
											<div class="col-lg-8">
												<button onclick="feed();" type="button" class="btn btn-success">下发设置</button>
											</div>
										</div>
									</div>
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								系统参数
							</header>
							<div class="panel-body">
								<div class="form-group">
								
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">控制器地址</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='lxcode' placeholder="" value="{$bw800Model['lxcode']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">路由器名称</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='routename' placeholder="" value="{$bw800Model['routename']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">路由器密码</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='routepass' placeholder="" value="{$bw800Model['routepass']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									</div>
									
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">服务器IP</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='serverip' placeholder="" value="{$bw800Model['serverip']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">服务器端口</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='serverport' placeholder="" value="{$bw800Model['serverport']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label"></label>
										<div class="col-lg-2">
										</div>
										<div class="col-lg-1"></div>
									</div>
									
									<!-- <div class="row">
										<div class="form-group">
											<div class="col-lg-8">
												<button onclick="updateBW800AddrVar();" type="button" class="btn btn-info">保存地址参数</button>
											</div>
										</div>
									</div> -->
									
								</div>
								
								<div class="form-group">
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">喂料曲线模式</label>
										<div class="col-lg-2">
											<!-- <input type="text" class="form-control" name='mode' placeholder="" value="{$bw800Model['mode']}"> -->
											<select class="form-control" name='mode' value="{$bw800Model['mode']}" style="width: 100%;">
												<if condition="$bw800Model['mode'] eq 0">
												<option value="0" selected="selected">初产</option>
												<else/>
												<option value="0" >初产</option>
												</if>
												
												<if condition="$bw800Model['mode'] eq 0">
												<option value="1">经产</option>
												<else/>
												<option value="1" selected="selected">经产</option>
												</if>
											</select>
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">每次下料(g)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='xlper' placeholder="" value="{$bw800Model['xlper']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<!-- <label for="input2" class="col-lg-1 col-sm-2 control-label">下料间隔(s)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='xlspace' placeholder="" value="{$bw800Model['xlspace']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div> -->
									</div>
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">是否自动下水</label>
										<div class="col-lg-2">
											<!-- <input type="text" class="form-control" name='waterauto' placeholder="" value="{$bw800Model['waterauto']}"> -->
											<select class="form-control" name='waterauto' value="{$bw800Model['waterauto']}" style="width: 100%;">
												<if condition="$bw800Model['waterauto'] eq 1">
												<option value="0" selected="selected">是</option>
												<else/>
												<option value="0" >是</option>
												</if>
												
												<if condition="$bw800Model['waterauto'] eq 1">
												<option value="1" selected="selected">否</option>
												<else/>
												<option value="1" >否</option>
												</if>
											</select>
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">下水时间(s)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='watertime' placeholder="" value="{$bw800Model['watertime']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">下水间隔(s)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='waterspace' placeholder="" value="{$bw800Model['waterspace']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									</div>
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">是否使用密码</label>
										<div class="col-lg-2">
											<!-- <input type="text" class="form-control" name='usepass' placeholder="" value="{$bw800Model['usepass']}"> -->
											<select class="form-control" name='usepass' value="{$bw800Model['usepass']}" style="width: 100%;">
												<if condition="$bw800Model['usepass'] eq 1">
												<option value="0" selected="selected">是</option>
												<else/>
												<option value="0" >是</option>
												</if>
												
												<if condition="$bw800Model['usepass'] eq 1">
												<option value="1" selected="selected">否</option>
												<else/>
												<option value="1" >否</option>
												</if>
											</select>
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">允许超出量</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='canover' placeholder="" value="{$bw800Model['canover']}">
											<!-- <select class="form-control" name='canover' value="{$bw800Model['canover']}" style="width: 100%;">
												<if condition="$bw800Model['canover'] eq 1">
												<option value="0" selected="selected">是</option>
												<else/>
												<option value="0" >是</option>
												</if>
												
												<if condition="$bw800Model['canover'] eq 1">
												<option value="1" selected="selected">否</option>
												<else/>
												<option value="1" >否</option>
												</if>
											</select> -->
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">待机背光</label>
										<div class="col-lg-2">
											<!-- <input type="text" class="form-control" name='idlebl' placeholder="" value="{$bw800Model['idlebl']}"> -->
											<select class="form-control" name='idlebl' value="{$bw800Model['idlebl']}" style="width: 100%;">
												<if condition="$bw800Model['idlebl'] eq 1">
												<option value="0" selected="selected">是</option>
												<else/>
												<option value="0" >是</option>
												</if>
												
												<if condition="$bw800Model['idlebl'] eq 1">
												<option value="1" selected="selected">否</option>
												<else/>
												<option value="1" >否</option>
												</if>
											</select>
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									</div>
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">要求喂食延迟(s)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='eatdelay' placeholder="" value="{$bw800Model['eatdelay']}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									</div>
								</div>
								
							</div>
						</section>
						
						
						<section class="panel">
							<header class="panel-heading">
								饲喂曲线
							</header>
							<div class="panel-body">
								<div class="form-group">
									<foreach name="bw800timeList" item="vo" key="k">
									<div class="row">
										<label for="input2" class="col-lg-1 col-sm-2 control-label">饲喂起始时间{$vo.index}</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='timestart{$vo.index}' placeholder="" value="{$vo.timestart}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">饲喂结束时间{$vo.index}</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='timeend{$vo.index}' placeholder="" value="{$vo.timeend}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">比例(%)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='percent{$vo.index}' placeholder="" value="{$vo.percent}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									</div>
									</foreach>
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								校正表
							</header>
							<div class="panel-body">
								<div class="form-group">
									<foreach name="bw800calList" item="vo" key="k">
									
									<if condition="$k%3 eq 0">
									<div class="row">
									</if>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">第{$vo.index}次出料重量(kg)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='weight{$vo.index}' placeholder="" value="{$vo.weight}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									
									<if condition="$k%3 eq 2 or $k eq 9">
									</div>
									</if>
									</foreach>
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								初产总量曲线
							</header>
							<div class="panel-body">
								<div class="form-group">
									<foreach name="bw800ccList" item="vo" key="k">
									
									<if condition="$k%3 eq 0">
									<div class="row">
									</if>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">第{$vo.day}天喂料量(kg)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='ccweight{$vo.day}' placeholder="" value="{$vo.weight}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									
									<if condition="$k%3 eq 2 or $k eq 26">
									</div>
									</if>
									</foreach>
								</div>
							</div>
						</section>
						
						<section class="panel">
							<header class="panel-heading">
								经产总量曲线
							</header>
							<div class="panel-body">
								<div class="form-group">
									<foreach name="bw800jcList" item="vo" key="k">
									
									<if condition="$k%3 eq 0">
									<div class="row">
									</if>
										
										<label for="input2" class="col-lg-1 col-sm-2 control-label">第{$vo.day}天喂料量(kg)</label>
										<div class="col-lg-2">
											<input type="text" class="form-control" name='jcweight{$vo.day}' placeholder="" value="{$vo.weight}">
											<p class="help-block"></p>
										</div>
										<div class="col-lg-1"></div>
									
									<if condition="$k%3 eq 2 or $k eq 26">
									</div>
									</if>
									</foreach>
								</div>
							</div>
						</section>
						
					</form>
				</div>
			</div>

		</div>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="__PUBLIC__/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="__PUBLIC__/js/jquery.scrollTo.min.js"></script>
    <script src="__PUBLIC__/js/jquery.nicescroll.js" type="text/javascript"></script>
	<!-- SlimScroll -->
	<script src="__PUBLIC__/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script src="__PUBLIC__/js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="__PUBLIC__/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="__PUBLIC__/js/owl.carousel.js" ></script>
    <script src="__PUBLIC__/js/jquery.customSelect.min.js" ></script>
	<script src="__PUBLIC__/assets/morris.js-0.4.3/morris.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/assets/morris.js-0.4.3/raphael-min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/respond.min.js" ></script>

    <!--right slidebar-->
    <script src="__PUBLIC__/js/slidebars.min.js"></script>

    <!--common script for all pages-->
    <script src="__PUBLIC__/js/common-scripts.js"></script>

	<!--this page plugins-->
	<script type="text/javascript" src="__PUBLIC__/assets/fuelux/js/spinner.min.js"></script>
	
	<!--custom switch-->
	<script src="__PUBLIC__/js/bootstrap-switch.js"></script>
	<!--custom tagsinput-->
	<script src="__PUBLIC__/js/jquery.tagsinput.js"></script>
	<!--custom checkbox & radio-->
	<script type="text/javascript" src="__PUBLIC__/js/ga.js"></script>
	
	<!-- layer -->
	<script src="__PUBLIC__/plugins/layer-v3.0.1/layer/layer.js"></script>

    <script>
		function savecqsetting(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/savecqsetting')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
		
		function savebrsetting(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/savebrsetting')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
		
		function updateBW800AddrVar(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/updateBW800AddrVar')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
	  
	    function updateBW800SystemVar(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/updateBW800SystemVar')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
	  
	    function updateBW800TimeTable(){
		    layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/updateBW800TimeTable')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	  }
	  
	    function updateBW800CalTable(){
		    layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/updateBW800CalTable')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
	  
	    function updateBW800ccTable(){
		    layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/updateBW800ccTable')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
	  
	    function updateBW800jcTable(){
		    layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/updateBW800jcTable')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '修改成功'
							, content: '修改成功'
						});
					}else{
						layer.open({
							title: '修改失败'
							, content: '修改失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
	    }
		
		
		function savebw800(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/savebw800')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					if(msg>=0){
						layer.open({
							title: '保存成功'
							, content: '保存成功'
						});
					}else{
						layer.open({
							title: '保存失败'
							, content: '保存失败'
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "text"
			});
		}
		
		function readBW800clock(){
			layer.load();
			$.ajax({
				  type: 'get',
				  url:"{:u('Setting/readBW800clock')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: {},
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						layer.open({
						  title: ''
						  ,content: msg.message
						}); 
					}else{
						
					}
				  },
				  error: function(XMLHttpRequest, textStatus, errorThrown) {
					//alert(XMLHttpRequest.status);
					//alert(XMLHttpRequest.readyState);
					//alert(textStatus);
					console.info(XMLHttpRequest);
					console.info(textStatus);
					console.info(errorThrown);
					if(textStatus.toLowerCase()=='parsererror'){
						layer.open({
							title: '错误'
							, content: XMLHttpRequest.responseText
						});
					}
				  },
				  dataType: "json"
			});
		}
	  
		function writeBW800clock(){
			layer.load();
			$.ajax({
				  type: 'get',
				  url:"{:u('Setting/writeBW800clock')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: {},
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						if(msg.message=="OK"){
							layer.open({
							  title: '设置成功'
							  ,content: '设置成功'
							}); 
						}else{
							layer.open({
							  title: ''
							  ,content: msg.message
							}); 
						}
					}
				  },
				  error: function(XMLHttpRequest, textStatus, errorThrown) {
						layer.closeAll('loading');
						//alert('提交失败'+XMLHttpRequest.status);
						layer.open({
						  title: '错误'
						  ,content: XMLHttpRequest.status
						});
				  },
				  dataType: "json"
			});
		}
	  
		function readBW800para(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/readBW800para')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					layer.closeAll('loading');
					console.info(msg);
					if(msg){
						$("input[name='lxcode']").val(msg.addr);
						$("input[name='routename']").val(msg.routeName);
						$("input[name='routepass']").val(msg.routepass);
						$("input[name='serverip']").val(msg.serverip);
						$("input[name='serverport']").val(msg.serverport);
						$("select[name='mode']").val(msg.mode);
						$("input[name='xlper']").val(msg.xlper);
						$("input[name='xlspace']").val(msg.xlspace);
						$("select[name='waterauto']").val(msg.waterauto);
						$("input[name='watertime']").val(msg.watertime);
						$("input[name='waterspace']").val(msg.waterspace);
						$("select[name='usepass']").val(msg.usePass);
						$("input[name='canover']").val(msg.canover);
						$("select[name='idlebl']").val(msg.idlebl);
						$("input[name='eatdelay']").val(msg.eatdelay);
						
						var timeTStart=msg.timeTStart;
						for(var i=0;i<timeTStart.length;i++){
							//console.info(timeTStart[i]);
							$("input[name='timestart"+(i+1)+"']").val(timeTStart[i]);
						}
						
						var timeTEnd=msg.timeTEnd;
						for(var i=0;i<timeTEnd.length;i++){
							//console.info(timeTStart[i]);
							$("input[name='timeend"+(i+1)+"']").val(timeTEnd[i]);
						}
						
						var timeTAmount=msg.timeTAmount;
						for(var i=0;i<timeTAmount.length;i++){
							//console.info(timeTStart[i]);
							$("input[name='percent"+(i+1)+"']").val(timeTAmount[i]);
						}
						
						var calTable=msg.calTable;
						for(var i=0;i<calTable.length;i++){
							$("input[name='weight"+(i+1)+"']").val(calTable[i]);
						}
						
						var totalTable_cc=msg.totalTable_cc;
						for(var i=0;i<totalTable_cc.length;i++){
							$("input[name='ccweight"+(i-8)+"']").val(totalTable_cc[i]);
						}
						
						var totalTable_jc=msg.totalTable_jc;
						for(var i=0;i<totalTable_jc.length;i++){
							$("input[name='jcweight"+(i-8)+"']").val(totalTable_jc[i]);
						}

						layer.open({
							title: '读取成功'
							, content: '读取成功'
						});
						
						/*layer.open({
							title: '读取成功'
							, content: msg
						});*/
						
					}
				  },
				  error: function(XMLHttpRequest, textStatus, errorThrown) {
					//alert(XMLHttpRequest.status);
					//alert(XMLHttpRequest.readyState);
					//alert(textStatus);
					console.info(XMLHttpRequest);
					console.info(textStatus);
					console.info(errorThrown);
					if(textStatus.toLowerCase()=='parsererror'){
						layer.open({
							title: '错误'
							, content: XMLHttpRequest.responseText
						});
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "json"
			});
		}
	  
		function writeBW800para(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/writeBW800para')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						if(msg.message=="OK"){
							layer.open({
								title: '成功'
								, content: '设置成功'
							});
						}else{
							layer.open({
							  title: ''
							  ,content: msg.message
							}); 
						}
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "json"
			});
		}
	  
		function cqsetting(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/cqsetting')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						if(msg.message=="OK"){
							layer.open({
								title: '成功'
								, content: '设置成功'
							});
						}else{
							layer.open({
							  title: ''
							  ,content: msg.message
							}); 
						}
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "json"
			});
		}
		
		function brsetting(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/brsetting')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: $("#id-form-system").serialize(),
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						if(msg.message=="OK"){
							layer.open({
								title: '成功'
								, content: '设置成功'
							});
						}else{
							layer.open({
							  title: ''
							  ,content: msg.message
							}); 
						}
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "json"
			});
		}
		
		function dnsetting(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/dnsetting')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: {},
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						if(msg.message=="OK"){
							layer.open({
								title: '成功'
								, content: '设置成功'
							});
						}else{
							layer.open({
							  title: ''
							  ,content: msg.message
							}); 
						}
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "json"
			});
		}
		
		function feed(){
			layer.load();
			$.ajax({
				  type: 'POST',
				  url:"{:u('Setting/feed')}"+"?rid={$bw800Model['rid']}&lxcode="+$("input[name='lxcode']").val(),
				  data: {},
				  success: function(msg){
					layer.closeAll('loading');
					if(msg){
						if(msg.message=="OK"){
							layer.open({
								title: '成功'
								, content: '设置成功'
							});
						}else{
							layer.open({
							  title: ''
							  ,content: msg.message
							}); 
						}
					}
				  },
				  complete: function(XMLHttpRequest, textStatus) { 
					layer.closeAll('loading');
				  },
				  dataType: "json"
			});
		}
		
		function initScroll(){
			var h=$(window).height();
			//出现滚动条
			$(".mybar").slimScroll({
				height:(h-10),
				size: '10px', //组件宽度
				color: '#000', //滚动条颜色
				position: 'right', //组件位置：left/right
				distance: '0px', //组件与侧边之间的距离
				start: 'top', //默认滚动位置：top/bottom
				opacity: .9, //滚动条透明度
				alwaysVisible: true, //是否 始终显示组件
				disableFadeOut: false, //是否 鼠标经过可滚动区域时显示组件，离开时隐藏组件
				railVisible: true, //是否 显示轨道
				railColor: '#333', //轨道颜色
				railOpacity: .2, //轨道透明度
				railDraggable: true, //是否 滚动条可拖动
				railClass: 'slimScrollRail', //轨道div类名 
				barClass: 'slimScrollBar', //滚动条div类名
				wrapperClass: 'slimScrollDiv', //外包div类名
				allowPageScroll: true, //是否 使用滚轮到达顶端/底端时，滚动窗口
				wheelStep: 20, //滚轮滚动量
				touchScrollStep: 200, //滚动量当用户使用手势
				borderRadius: '7px', //滚动条圆角
				railBorderRadius: '7px' //轨道圆角
			});
	    }
	  $(window).resize(function(){
		initScroll();
	  });
	  $(document).ready(function() {
		initScroll();
	  });
    </script>

  </body>
</html>
